package servlet;


import homework.HttpProtocolUtil;
import homework.HttpServlet;
import homework.Request;
import homework.Response;

import java.io.IOException;

/**
 * @Author: fanbo
 * @Date: 2021/1/25 6:21 上午
 */
public class ServletDemoTwo extends HttpServlet {

    @Override
    public void doGet(Request request, Response response) {
        System.out.println("ServletDemoTwo doGet...");
        String content = "<h1>Servlet Demo Two</h1>";
        try {
            response.output(HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doPost(Request request, Response response) {

    }

    @Override
    public void init() throws Exception {
        System.out.println("ServletDemoTwo init...");
    }

    @Override
    public void destory() throws Exception {

    }
}
